package com.gjy.test.other;

/**
 * @author 宫静雨
 * @version 1.0
 * @since 2022-12-27 13:52:29
 */
public class T5 {

    public static void main(String[] args) {
        System.out.println(Status.valueOf("A"));
    }

    private enum Status {
        A("a", 0),
        B("b", 1),
        C("c", 2);

        private final String name;
        private final Integer age;

        Status(String name, Integer age) {
            this.name = name;
            this.age = age;
        }

        public String getName() {
            return name;
        }

        public Integer getAge() {
            return age;
        }

        public static Status getValue(String name) {
            for (Status value : values()) {
                if (valueOf(name).equals(value)) {
                    return value;
                }
            }
            return null;
        }

        @Override
        public String toString() {
            return "Status{" +
                    "name='" + name + '\'' +
                    ", age=" + age +
                    '}';
        }
    }
}
